<?php
	defined('INDEX') or die ('Acesso direto n&atilde;o permitido');
	
	class CapabilityManager
	{
		public function __construct ()
		{
			
		}
		
		/**
		 * This function checks if current user has capability to
		 * execute an action.
		 * 
		 * @param string $capability
		 * 
		 * @return bool $can
		 */
		public function hasCapability ($capability)
		{
			if($capability != '')
			{
				require_once (dirname(__FILE__)."/../application/ApplicationFactory.class.php");
				
				$connection = ApplicationFactory::getDoctrineConnectionFactory();
				
				$table = Doctrine::getTable('Capacidade');
				
				$capacidade = $table->findBy('nome', $capability)->getFirst();
				
				if($capacidade)
				{
					return true;
				}
				else
				{
					return false;
				}
			}
			else
			{
				return false;
			}
		}
	}
?>